package com.yellowpage.nsp.service;

import java.util.List;
import java.util.Map;

import org.springframework.transaction.TransactionDefinition;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.support.DefaultTransactionDefinition;

import com.yellowpage.white.common.Constants;
import com.yellowpage.white.common.PageRender;
import com.yellowpage.white.dao.QueryAssistantSQL;
import com.yellowpage.white.service.BaseServiceImpl;

import com.yellowpage.nsp.data.NspTelLog;
import com.yellowpage.nsp.dao.NspTelLogDao;

public class NspTelLogServiceImpl extends BaseServiceImpl implements NspTelLogService {
	  private NspTelLogDao nspTelLogDao;
	
	  public void setNspTelLogDao(NspTelLogDao nspTelLogDao) {
		  this.nspTelLogDao = nspTelLogDao;
	  }
	
	
	  /* Smooth generate Method */ 
	  public NspTelLog getNspTelLog(Long id){
	      return nspTelLogDao.get(id);
	  }
	  
    public List<NspTelLog> getAllNspTelLog(){
        return nspTelLogDao.getAll();
    }
    
    public List<Map> queryNspTelLogByPage(Map queryMap, PageRender pageRender) {		
        
		QueryAssistantSQL sqlAssistant = baseDao.newQueryAssistantSQL(
				"SELECT a.TEL_TYPE , a.QUERY_NUM , a.LOG_TIME , a.SIGN_NOTE , a.SUBJECT_NUM , a.ID    FROM NSP_TEL_LOG a WHERE 1=1 ")
				    			.addCondition(" and TEL_TYPE = :telType ")
							    			.addCondition(" and QUERY_NUM = :queryNum ")
							    			.addCondition(" and LOG_TIME = :logTime ")
							    			.addCondition(" and SIGN_NOTE = :signNote ")
							    			.addCondition(" and SUBJECT_NUM = :subjectNum ")
							    			.addCondition(" and ID = :id ")
							    ; 		    
		    

		List<Map> resultList = sqlAssistant.queryByPage(
				baseDao.getConnection(), queryMap, pageRender);

		return resultList;
	}
    
    
    public void saveNspTelLog(NspTelLog nspTelLog){
        nspTelLogDao.save(nspTelLog);
    }
    
	  public void updateNspTelLog(NspTelLog nspTelLog){
	      nspTelLogDao.update(nspTelLog);
	  }
	  
	  public void delete(List deleteList){
	      nspTelLogDao.remove(deleteList);
	  }
	  
	  
	 
	
}	